/*
 * AST.cpp
 *
 *  Created on: Aug 5, 2009
 *      Author: ramesh
 */

#include "AST.h"

using namespace SymphonyAST;


Class* SymphonyAST::getContainingClass(Node* node) {
	while (node->getId() != "class") {
		node = node->parent;
	}

	return (Class*)node;
}


Method* SymphonyAST::getContainingMethod(Node* node) {
	while (node->getId() != "method") {
		node = node->parent;
	}

	return (Method*)node;
}


Scope* SymphonyAST::getFirstNonExpression(Node* node) {
	while (node->getId() == "exp") {
		node = node->parent;
	}

	return (Scope*)node;
}
